*** This do file creates the database for  												*/
*** Vaccine Determinants paper															*/
*** Krishna Chaitanya Vadlamannati(UCD, Ireland) 										*/
*** Vinícius Rodrigues Vieira (FAAP, Brazil)											*/
*** Terence Song (China) 																*/
*****************************************************************************************
*** Last update: December 12, 2023
*****************************************************************************************
/* Note: This do file contains three parts: 											*/
/* 1) Preparation of data file															*/
/* 2) Data Manipulation		  															*/
/* 3) Regression Analysis 																*/
/* Change local China Vaccines to the directory where you store the raw data			*/
/* Running the do file creates the transformed data in the file "Master"				*/
/* The corresponding output tables are saved in the new folder "tables"					*/
/* The output tables are saved into excel using "outreg2" command						*/
*****************************************************************************************

set more off 

******************************** Provide labels ********************************************

label var vac_dummy1 "Vaccine dummy"
label var purchase1 "Vaccine Purchase"
label var donation1 "Vaccine Donation"
label var vac_count "Vaccine Count"
label var lic "Low Income Country dummy"
label var mi "Middle Income Country dummy"
label var lnpcgdp "Per capita GDP (log)"
label var lndeathspm_june21 "Covid Deaths per head (log)"
label var fh "Freedom House index"
label var ctrade_share "Trade with China share"
label var bri "BRI dummy"
label var unga_us "UNGA index with US"
label var unga_chn "UNGA index with China"
label var sea "Southeast Asia dummy"
label var ssa "Sub-Saharan Africa dummy"
label var lac "Latin America dummy"
label var mena "MENA dummy"
label var ca "Central Asia dummy"
label var pta_usa "PTA"
label var all_usa "PTA US"
label var other_vac "Other Vaccines"
label var dcs "developing countries dummy"


******************************************************* Descriptive Statistics **********************************************************


sum(vac_dummy1 purchase1 donation1 vac_count lic mi lnpcgdp lndeathspm_june21 fh ctrade_share bri unga_us unga_chn other_vac sea ssa lac mena ca)


****************************************************** Correlation Matrix ****************************************************************


corr(vac_dummy1 purchase1 donation1 vac_count lic mi lnpcgdp lndeathspm_june21 fh ctrade_share bri unga_us unga_chn other_vac sea ssa lac mena ca)


****************************************************** Graphs ****************************************************************************

***** Figure 4A
xi: logit vac_dummy1 lic mi lndeathspm_june21 sea ssa lac mena ca if dcs==1, robust
lroc, nograph
predict xb1, xb

xi: logit vac_dummy1 lic mi lndeathspm_june21 fh ctrade_share sea ssa lac mena ca if dcs==1, robust
predict xb2, xb
roccomp vac_dummy xb1 xb2, graph summary name(A) 
drop xb1 xb2


***** Figure 4B
xi: logit vac_dummy1 lic mi lndeathspm_june21 sea ssa lac mena ca if dcs==1, robust
lroc, nograph
predict xb1, xb

xi: logit vac_dummy1 lic mi lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, robust
predict xb2, xb
roccomp vac_dummy xb1 xb2, graph summary name(B) 
drop xb1 xb2

graph combine A B, name(combined_ROC) 





*************************************************************************************************************************************************************************
************************************************************** TABLE 1  [VACCINE MODELS: GATE KEEPING STAGE] *************************************************************
*************************************************************************************************************************************************************************

* Column 1: Needs model
xi: logit vac_dummy1 lic mi lndeathspm_june21 sea ssa lac mena ca if dcs==1, robust
tab country if e(sample)==1
estimates store t1
outreg2 using "t1", excel

* Column 2: Extension model
xi: logit vac_dummy1 lic mi lndeathspm_june21 fh ctrade_share sea ssa lac mena ca if dcs==1, robust
tab country if e(sample)==1
outreg2 using "t1", excel

* Column 3: All variables
xi: logit vac_dummy1 lic mi lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, robust
tab country if e(sample)==1
outreg2 using "t1", excel

*************************************************************************************************************************************************************************
************************************************************** TABLE 2  [VACCINE MODELS: PURCHASES MODEL] ****************************************************************
*************************************************************************************************************************************************************************

* Column 1: Needs model
xi: tobit purchase1 lic mi lndeathspm_june21 sea ssa lac mena ca if dcs==1, ul(214) vce(robust)
tab country if e(sample)==1
estimates store t2
outreg2 using "t2", excel

* Column 2: Extension model
xi: tobit purchase1 lic mi lndeathspm_june21 fh ctrade_share sea ssa lac mena ca if dcs==1, ul(214) vce(robust)
tab country if e(sample)==1
outreg2 using "t2", excel

* Column 3: All variables
xi: tobit purchase1 lic mi lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, ul(214) vce(robust)
tab country if e(sample)==1
outreg2 using "t2", excel

*************************************************************************************************************************************************************************
************************************************************** TABLE 3  [VACCINE MODELS: DONATIONS MODEL] ****************************************************************
*************************************************************************************************************************************************************************

* Column 1: Needs model
xi: tobit donation1 lic mi lndeathspm_june21 sea ssa lac mena ca if dcs==1, ul(12) vce(robust)
tab country if e(sample)==1
estimates store t3
outreg2 using "t3", excel

* Column 2: Extension model
xi: tobit donation1 lic mi lndeathspm_june21 fh ctrade_share sea ssa lac mena ca if dcs==1, ul(12) vce(robust)
tab country if e(sample)==1
outreg2 using "t3", excel

* Column 3: All variables
xi: tobit donation1 lic mi lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, ul(12) vce(robust)
tab country if e(sample)==1
outreg2 using "t3", excel



*************************************************************************************************************************************************************************
*********************************************************** ROBUSTNESS TEST 1 - Supplemental Table 6  ****************************************************************
*************************************************************************************************************************************************************************

*** Vaccine shipment deliveries:

* Negative Binomial: Vaccine count
xi: nbreg vac_count lic mi lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, robust
estimates store r1
outreg2 using "r1", excel


*************************************************************************************************************************************************************************
*********************************************************** ROBUSTNESS TEST 2 - Supplemental Table 7  ****************************************************************
*************************************************************************************************************************************************************************

* OLS: Vaccine gate keeping
xi: reg vac_dummy1 lic mi lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, robust
estimates store r2
outreg2 using "r2", excel


*************************************************************************************************************************************************************************
*********************************************************** ROBUSTNESS TEST 3 - Supplemental Table 8  ****************************************************************
*************************************************************************************************************************************************************************

* Column 1 Vaccine: with Per capita GDP
xi: logit vac_dummy1 lnpcgdp lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, robust
estimates store r3
outreg2 using "r3", excel

* Column 2 Purchases: with Per capita GDP
xi: tobit purchase1 lnpcgdp lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, ul(214) robust
outreg2 using "r3", excel

* Column 2 Donation: with Per capita GDP
xi: tobit donation1 lnpcgdp lndeathspm_june21 fh ctrade_share bri unga_us sea ssa lac mena ca if dcs==1, ul(12) vce(robust)
outreg2 using "r3", excel


*************************************************************************************************************************************************************************
*********************************************************** ROBUSTNESS TEST 4 - Supplemental Table 9  ****************************************************************
*************************************************************************************************************************************************************************

* Column 1 Vaccine: with UNGA China
xi: logit vac_dummy1 lic mi lndeathspm_june21 fh ctrade_share bri unga_chn sea ssa lac mena ca if dcs==1, robust
estimates store r4
outreg2 using "r4", excel

* Column 2 Purchases: with UNGA China
xi: tobit purchase1 lic mi lndeathspm_june21 fh ctrade_share bri unga_chn sea ssa lac mena ca if dcs==1, ul(214) vce(robust)
outreg2 using "r4", excel

* Column 3 Donation: with UNGA China
xi: tobit donation1 lic mi lndeathspm_june21 fh ctrade_share bri unga_chn sea ssa lac mena ca if dcs==1, ul(12) vce(robust)
outreg2 using "r4", excel


*************************************************************************************************************************************************************************
*********************************************************** ROBUSTNESS TEST 5 - Supplemental Table 10  ****************************************************************
*************************************************************************************************************************************************************************

* Column 1 Vaccine: with US PTA:
xi: logit vac_dummy1 lic mi lndeathspm_june21 fh ctrade_share bri unga_chn pta_usa sea ssa lac mena ca if dcs==1, robust
estimates store r5
outreg2 using "r5", excel

* Column 2 Purchases: with US PTA:
xi: tobit purchase1 lic mi lndeathspm_june21 fh ctrade_share bri unga_chn all_usa sea ssa lac mena ca if dcs==1, ul(214) vce(robust)
outreg2 using "r5", excel

* Column 3 Donation: with US PTA:
xi: tobit donation1 lic mi lndeathspm_june21 fh ctrade_share bri unga_chn all_usa sea ssa lac mena ca if dcs==1, ul(12) vce(robust)
outreg2 using "r5", excel


*************************************************************************************************************************************************************************
*********************************************************** ROBUSTNESS TEST 6 - Supplemental Table 11  ****************************************************************
*************************************************************************************************************************************************************************

* Column 1 Purchases: with other approved vaccines
xi: tobit purchase1 lic mi lndeathspm_june21 fh ctrade_share bri unga_us other_vac sea ssa lac mena ca if dcs==1, ul(214) vce(robust)
estimates store r6
outreg2 using "r6", excel

* Column 2 Donation: with other approved vaccines
xi: tobit donation1 lic mi lndeathspm_june21 fh ctrade_share bri unga_us other_vac sea ssa lac mena ca if dcs==1, ul(12) vce(robust)
outreg2 using "r6", excel

